var bookIsCover=true;
var bookCoverHtml;
var bookContentHtml;
function bookHome(divid){
	bookCoverHtml = $("#"+divid).html();
	self.setInterval("getbookContentHtml()",10000);
	self.setInterval("bookShowContent('"+divid+"')",17000);
}

function bookShowContent(divid){
	
	if(bookContentHtml==null||bookContentHtml==""){
		return;		
	}
	if(bookIsCover){
		

		$("#"+divid).empty();
		$("#"+divid).append(bookContentHtml);
		
		$("#"+divid).find(".book1").fadeIn(1000);
		bookIsCover = false;
	}else{
		$("#"+divid).find(".book1").fadeOut(1000,function(){
			$("#"+divid).empty();
			$("#"+divid).append(bookCoverHtml);
			bookIsCover = true;
		});
		
	}
	refreash();
}

function getbookContentHtml(){
	$.getJSON("book_searchTop10ByRandom.do",{},function(json){
		if(json[0].pageurl == null||json[0].pageurl==""){
			json[0].pageurl = "compents/book/images/nocover.jpg";
		}
		bookContentHtml = '<div class="book1" style="width:100%;float:left;display:none;height:100%;text-align:left;" ><div style="padding-left:5%;padding-top:7%;float:left;width:30%;height:80%;"><img id="'+json[0].id+'" src="'+json[0].pageurl+'" style="width:90%;height:90%;cursor:pointer;border:#f8f7f0 2px solid;"/></div><div  style="float:left;padding-left:3%;padding-top:10%;width:60%;height:80%;" ><div style="padding-top:5px;" class="covertext2">'+json[0].name+'</div><div style="padding-top:5px;" class="covertext2">'+"更新至："+json[0].state+'</div><div style="padding-top:5px;" class="covertext2">'+"作者："+json[0].author+'</div></div></div>';
	});
	
}